Structure File Format

Introduction

This document describes the .STR file format. The file MIN2.STR is used as an example to illistrate the descriptions. This file is also used in the roundtrip test. To facilitate manual inspection of .STR files (when creating unit tests, for instance) the tables in this document are also provided as template documents.

General Format

A .STR file is divided into 32 byte blocks. These blocks are organized into block groups. Each block group has a specific meaning. A block group starts with a 4-byte header. This header consists of two fields. The first two bytes contain the number of blocks in the previous group, the third and fourth byte contain the number of bytes after the header in the current block group. From the second field we can calculate the number of blocks in the current block group.

A block group consists of fields (not to be confused with fields in a panel, which is a high-level concept). Some fields point to other block groups. They do so by block number, that is to say the zero-based block number of the starting block of the block group. These pointers are three bytes long.

All integer values (2- or 3-byte values) seem are in little endian order, i.e., most significant byte last. (E.g., 01h 00h = 1 and 00h 01h = 256).

In the tables the following shortcut notations are used:

“Block → <description>” means the value of the field is a pointer to the block group described.

“Subblock→ <description>” means the value of the field is an offset to the subblock decribed.

Block #0

WP header. It seems that the STR file follows the format of a “WordPerfect text file” which is probably the name of a file type used by WordPerfect. Block 0 does not seem to contain any data interesting to us.

Block #1 + 2

Lew Bastian's document explains something about block group chains. Not clear how this works. So far we do not seem to need this.

Block #3

Seems to be the starting point.

Offset in sample	60h
Offset	Length	Sample	Decription
0	2	00 00	Number of blocks in the previous group
2	2	39 00	Number of bytes after header in this group
4	1	00	Number of users in report setup (always 0 if not open in DP)
5	1	00	not used
6	2	00 00	Pointer to menu, pointer to list ?
8	3	27 00 00	Block→ Printer Map list
11	3	0F 00 00	Block →Constants
14	3	05 00 00	Block → Panel list
17	3	00 00 00	Definer passwd, supervisor passwd, user passwd (hash?)
20	3	00 00 00	Block → (?) Global macros (not implemented)
23	3	32 00 00	Block → Report list
26	3	00 00 00	Block → (?) Variables (not implemented)
29	3	00 00 00	Block → (?) Transaction journal filename
32	3	00 00 00	Block → Developer banner
35	3	48 00 00	Block → 510 byte hotlist of most used panels (or something)

Printer Map List

Offset in sample	4E0h
Offset	Length	Sample	Decription
0	2	02 00	Number of blocks in the previous group
2	2	1C 00	Number of bytes after header in this group
4	3	28 00 00	Block → first printer map
7	3	00 00 00 (=n/a)	Block → second printer map
etc	etc	etc	etc

Constants

In the export file (.STE) the ALT.MAP values are sorted, in the STR the order is different

Offset in sample	1E0h
Offset	Length	Sample	Decription
0	2	0A 00	Number of blocks in the previous group
2	2	1C 00	Number of bytes after header in this group
4	3	10 00 00	Block → SORT data
7	3	19 00 00	Block → UP.CASE data
10	3	22 00 00	Block → ALT.MAP data
13	3	24 00 00	Block → CTRL.MAP data
16	3	25 00 00	Block → MONTHS data
19	3	31 00 00	Block → Defaults for colors, computationals, dates & times
22	3	00 00 00	user ID panel #

Panel List

Offset in sample	A0h
Offset	Length	Sample	Decription
0	2	02 00	Number of blocks in the previous group
2	2	2C 01	Number of bytes after header in this group
4	3	3B 00 00	Block → first panel definition
7	3	41 00 00	Block → second panel definition
10	3	00 00 00	Block → third panel definition
etc	etc	etc	etc

Defaults

Constant defaults. 15 bytes allocated; 13 used.

Offset in sample	520h
Offset	Length	Sample	Decription
0	2	Number of blocks in the previous group
2	2	Number of bytes after header in this group
4	1	Color 1
5	1	Color 2
6	1	Color 3
7	1	Color 4
8	1	Menu.Edit.Color
9	1	Period
10	1	Comma
11	1	07	YMD
12	1	02	HMS
13	1	Line0
14	1	Date0Type
15	1	AutoHelp
16	1	Report.Display.On/Off
17	1	allocated
18	1	allocated

Panel Definition

First panel is used as the example.

Offset in sample	760h
Offset	Length	Sample	Decription
0	2	01 00	Number of blocks in the previous group
2	2	5D 00	Number of bytes after header in this group
4	1	01	??
5	1	01	Panel number?
6	2	0A 00	Record length
8	3	39 00 00	Block → panel file name
11	1	07	Color code
12	1	01	x-position
13	1	09	y-position
14	1	4D	width
15	1	0E	height
16	2	39 00	Offset → field data list1 Offset within a block group are from the third byte of the block group. In this context apparently the “number of blocks in previous group” field is not considered part of the block group.
18	2	42 00	Offset → field extension data list
20	3	3A 00 00	Block → Panel text
23	1	48 0 0 0 1 0 0 1 0	Flags (bit nr – mask – description) 1 – 01h – auto save when return is hit on last field 2 – 02h – auto create on change if bit 7 is also 1 3 – 04h – at least one index is empty 4 – 08h – show panel during lookup 5 – 10h – ? 6 – 20h – this panel does totaling - set by DISP-SET1 7 – 40h – panel is valid 8 – 80h – auto edit on change
24	1	0F	field color
25	1	70	color of field being edited
26	2	00 00	not used
28	3	46 00 00	Block → Picture display info
31	3	00 00 00	Block → Title (= panel name)
34	4	00 00 00 00	Lookup area: x y width height
38	2	26 00	Offset → Index list
40	?	Start of index list. Each item is an index structure as described below. The list ends with a 00h, after which the field data list should start (see offset 16). After the field data list the field extension data list should start.

Index Structure

The first index structure in the panel is used as an example.

Offset in sample	788h
Offset	Length	Sample	Decription
0	1	08	Length of this index structure
1	1	01	Index number
2	1	01 1 0 0 0 0 0	Flags (bit nr – mask – description) 1 – 01h – allocated 2 – 02h – 1 if redefined or cleared - needs to be regenerated 3 – 04h – exception only index 4 – 08h – used by BREPLACE to indicate that index needs delete-insert 5 – 10h – used by IND-GEN to indicate index is being regenerated 6 – 20h – used by IND-GEN -- flips every 10 seconds to indicate regen is alive
3	3	01 00 00	Index base block number (in the index file?)
6	1	01	Field string
7	1	01	Exception string (if exception only → offset 2 bit 3)

Field Data Structure

The first and only field of the first panel is used as an example.

Offset in sample	79Bh
Offset	Length	Sample	Decription
0	1	01	Field number
1	1	0000 0000b	Flags 1 (binary – hex – description) 0000 0000 – 00h – character 0000 0001 – 01h – virtual 0000 0010 – 02h – down arrow door 0000 0011 – 03h – door only field 0000 0100 – 04h – date 0000 1100 – 0Ch – binary or time 0001 1100 – floating packed 0000 1000 – 08h – text 0010 0000 – 20h – field has total target 0100 0000 – editing not allowed 1000 0000 – must not be zero/blank Obviously not all combinations of above are possible (probably not necessary)
2	1	00	Flags 2 (bit nr – mask – description) 1 – 01h – initial on create 2 – 02h – initial on create save 3 means recompute hot 3 – 04h – value check at edit 4 – 08h – value check at save 5 – 10h – search field list defined 6 – 20h – n-type field - used in index key generation 7 – 40h – hidden 8 – 80h – auto-increment
3	1	0A	Character field → the length of the field in the record. Binary G,H numbers → decimal scale. N numbers, packed & binary → the number of digits for index (length is always 4 bytes ). dates, times, textpointers, and G packed numbers → 0. Note: in packed format each half byte codes one digit.
4	2	00 00	Offset in record for the field.
6	2	00 00	Offset in field extension data.

Field Extension Data Structure

The first and only field of the first panel is used as an example.

Offset in sample	7A4h
Offset	Length	Sample	Decription
0	1	1B	Length of this field extension data structure (excluding this length field).
1	1	00	X coordinate
2	1	00	Y coordinate
3	3	00 00 00	Block → Help text
6	1	00 0 0 ...	Flags 2 (bit nr – mask – description) 1 – 01h – Auto-enter 2 – 02h – Right-justify
7	1	01	Left (?)
8	1	01	Right (?)
9	1	01	Up (?)
10	1	01	Down (?)
11	?	List of typed values. This seems to be some kind of map structure. There are 12 types, but they are not all present. Each is present only once. The format of a typed value is specified below.

Typed Value

The first typed value (a format picture) is used as an example. Quoted parts in the description are taken (almost) literally from Lew Bastian's document. We don't necessarily understand what he means.

Offset	Length	Sample	Description
0	1	05	Code that specifies the type of value that follows. One of: 01 – “lnth t1 pf1 tf1 < ti pfi tfi > - used for total target groups of 3 bytes --- lnth is multiple of 3. means follow field pf# in this panel to field tf# in the target panel” 02 – Block → Field value list 03 – initialization 04 – edit check 05 – format picture (must be the first) 06 – “search list of which first byte is length” 07 – door definition 08 – “8-bytes next packed decimal value for auto increment field” 09 – “lookup list – length,index,fields” 10 – “display.length, display.depth” 11 – “auto lookup list used with type 7 - length, fields in other panel” 12 – field name
1	1	03	Length n of the payload
2	n	41 31 30 (=“A10”)	Payload

Typed Value: 03 Initialization

A regular field may be initialized with a value, a range check or a formula. Computed fields may be initialized with a formula only.

Offset	Length	Sample	Description
0	1	03	Initialization identifier
1	1	07	Length: always 7 bytes
2	1	03	Kind: initial value (01), range check (02) or formula (03)
3	3	3D 00 00	Block → Pointer1 Pointer1 points to a number or text for kinds value and range, and to a formula for kind formula.
6	3	3C 00 00	Block → Pointer2 Pointer2 is 0 for kinds value and range, and points to a source for kind formula.

Typed Value: 07 Door Definition

A door definition field may be a data link or a panel link. Data link data are saved in the panel file. Panel link data are not.

The length of a door definition may vary depending on the number of fields in the Lookup Field List.

Offset	Length	Sample	Description
0	1	07	Door Definition identifier
1	1	07	Length: variable
2	1	02	Panel number linked to
3	1	03	Field number linked to
4	1	01	Index linked to
5	1	00	Flags
6	1	02	Length Lookup Field List: variable
7	1	02	Field List Key 2
8	1	03	Field List Key 3